import React from 'react';
import {Switch , Route} from 'react-router-dom';
import { store } from '../store'
import user from '@pages/system/user'
import role from '@pages/system/role'
import tableDemo from '@pages/reactMng/tableDemo'

const RouterComponent = ()=> {
    console.log(111,store.getState().base.routerData)
    const { routerData } = store.getState().base
    const routerDataHtml = routerData.map( (item,index) => {
        return (
        <Route path={ item.path } exact component={ item.component } key={index}/>
        )
    })
    return (
        <Switch>
            {/* <Route path="/" exact component={ home }/>
            
            <Route path="/react/reduxDemo" exact component={ reduxDemo }/>
            <Route path="/react/routerDemo" exact component={ routerDemo }/>
            <Route path="/react/tableDemo" exact component={ tableDemo }/>
            <Route path="/react/tableDemo/sub" exact component={ tableDemo }/>

            <Route path="/system/user" exact component={ user }/>
            <Route path="/system/role" exact component={ role }/> */}
           
            { routerDataHtml }
            <Route path="/system" exact render={ ()=> (
                <Switch>
                     <Route path="/system/aouth1" exact component={ tableDemo }/>
                     <Route path="/system/role" exact component={ role }/>
                </Switch>
            ) }/>
           
           
        </Switch>
    )
}

export default RouterComponent;